package com.api.shopapi.service.impl;

import com.api.shopapi.entity.ETakeDrugs;
import com.api.shopapi.mapper.ETakeDrugsMapper;
import com.api.shopapi.service.ETakeDrugsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ETakeDrugsServiceImplOne")
public class ETakeDrugsServiceImpl implements ETakeDrugsService {

    @Autowired
    private ETakeDrugsMapper takeDrugsMapper;

    @Override
    public int insert(ETakeDrugs takeDrugs) {
        return takeDrugsMapper.insert(takeDrugs);
    }

    @Override
    public int update(ETakeDrugs takeDrugs) {
        return takeDrugsMapper.update(takeDrugs);
    }

    @Override
    public int delete(String eTakeDrugsCode) {
        return takeDrugsMapper.delete(eTakeDrugsCode);
    }

    @Override
    public ETakeDrugs getByETakeDrugsCode(String eTakeDrugsCode) {
        return takeDrugsMapper.getByETakeDrugsCode(eTakeDrugsCode);
    }

    @Override
    public PageInfo<ETakeDrugs> getPageListByElderlyCode(int pageIndex, int pageSize, String elderlyCode) {
        PageHelper.startPage(pageIndex,pageSize);
        List<ETakeDrugs> takeDrugsList = takeDrugsMapper.getPageListByElderlyCode(elderlyCode);
        return new PageInfo<>(takeDrugsList);
    }
}
